[% setvar title Improve Perl Persistance %]
<div id="archive-notice">
    <h3>This file is part of the Perl 6 Archive</h3>
    <p>To see what is currently happening visit <a href="http://www.perl6.org/">http://www.perl6.org/</a></p>
</div>
<div class='pod'>
<a name='TITLE'></a><h1>TITLE</h1>
<p>Improve Perl Persistance</p>
<a name='VERSION'></a><h1>VERSION</h1>
<pre>  Maintainer: Adam Turoff &lt;<a href='mailto:ziggy@panix.com'>ziggy@panix.com</a>&gt;
  Date: 24 Sep 2000
  Last Modified: 30 Sep 2000
  Mailing List: <a href='mailto:perl6-language@perl.org'>perl6-language@perl.org</a>
  Number: 287
  Version: 2
  Status: Frozen</pre>
<a name='ABSTRACT'></a><h1>ABSTRACT</h1>
<p>Many mechanisms exist to make perl code and data persistant.  They should
be cleaned up, unified, and documented widely within the core
documentation.</p>
<a name='DESCRIPTION'></a><h1>DESCRIPTION</h1>
<p>Tom Christiansen proposed this in his perl6storm message:</p>
<pre>	=item perl6storm #0022

	make marshalling easy.  core module?  would this allow for easy
	persistence of data structures other than dbm files?
	general persistence is hard, right?  can this be an attribute?</pre>
<p>Python offers one way to make code/data persistant: the <code>pickle</code> interface.
More complex serialization can be accomplished through the 'shelve'
interface or DBM files.  This capability is quite useful, widely known and
easily used.</p>
<p>Perl, by comparison, offers Data::Dumper, which can serialize Perl objects
that are rather asymetrically reconstituted by using <code>eval</code> or <code>do</code>.
Perl also offers solid, simple interfaces into DBM and Berkeley DB files,
and offer a well known, low-level serialization mechanism.</p>
<p>CPAN offers many other serialization modules that are only slightly
different than Data::Dumper.  This plethora of serialization mechanisms
confuses users and adds to code bloat when multiple modules each use
different serialization mechanisms that are all substantially similar.</p>
<p>Something similar to Python's <code>pickle</code> interface should be added into Perl
as a builtin; this feature should have a symmetric &quot;restore&quot; builtin (eg
save()/restore(), freeze()/thaw(), dump()/undump()...).</p>
<p>Furthermore, Perl's low level serialization machinery (DBM, SDBM, GDBM,
Berkeley DB) should be unified into a single core module, where the
underlying DBM implementations are pluggable drivers, like DBI's DBD
infrastructure.</p>
<a name='IMPLEMENTATION'></a><h1>IMPLEMENTATION</h1>
<p>First, the issue of adding builtin serialization functions needs to be
addressed.  This is a language issue because serialization should be more
visible than it is today, and the best way to accomplish that is to include
this feature as a pair of builtin functions.</p>
<p>If this feature is implemented through a core module, that module might
best be presented as a pragmatic module.</p>
<p>Finally, although this proposal describes a simple matter of programming,
some of the issues (such as pluggable interfaces) are best hashed out at a
language-design level, so that they may be used elsewhere, easily.</p>
<a name='REFERENCES'></a><h1>REFERENCES</h1>
<p>Python Pocket Reference, Chapter 12</p>
<p>perl6storm</p>
</div>
